var express = require('express');
var router = express.Router();
var loginController = require("./../controller/LoginController");

/* GET home page. */
router.get('/', function(req, res, next) {
	//req.session.user = "王二";
  res.render('index', { title: 'Express' });
});

router.get("/query",function(req,res,next){
	console.log("get 请求的参数为："+ JSON.stringify(req.query));
	console.log("post 请求的参数为："+JSON.stringify(req.query));
	console.log("q 的值为："+req.query.q);
});


router.get('/test/:urlname', function (req, res,next) {
  console.log('url参数对象 :',req.params);
  console.log('get请求参数对象 :',req.query);
  console.log('post请求参数对象 :',req.body);
  console.log('q的值为 :',req.params.urlname);
});

router.post('/body', function (req, res, next) {
  console.log('get请求参数对象 :',req.query);
  console.log('post请求参数对象 :',req.body);
  console.log('q的值为 :',req.body.q);
});



router.get('/login',loginController.userLogin);
router.get('/logind',loginController.userLogined);


router.get("/userlogout",(req,res,next) => {
	req.session.destroy()
	 res.send("退出成功哦")
});


module.exports = router;
